package team.nmsg.ge.system.init;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import team.nmsg.ge.system.util.ServerParams;
import team.nmsg.ge.system.util.SysSpringContext;

public class SysStartRun  implements  ApplicationListener<ContextRefreshedEvent> {
	
	private static final Logger logger = LoggerFactory.getLogger(SysStartRun.class);
	
	private Boolean init = false;	
	
	@Override
	public void onApplicationEvent(ContextRefreshedEvent event) {
		
		ApplicationContext appContext = event.getApplicationContext();
		
//		ResourceBundleMessageSource budle = appContext.getBean(ResourceBundleMessageSource.class);
//		
//		budle.setUseCodeAsDefaultMessage(true);
		
		InitSystemAuth.loadSysAuth();
		CommonDefine.initCommonDefine(SysSpringContext.getAppContext());
//		team.nmsg.nps.res.common.init.CommonDefine.initCommonDefine(SysSpringContext.getAppContext());

		SysServletContextListener.j2eeApplication.setAttribute("_SYSNAME", ServerParams.SYS_NAME);
		SysServletContextListener.j2eeApplication.setAttribute("_SYSVER", ServerParams.SYS_VERSION);
		
//		List<String> msg =new ArrayList<String>();
//		msg.add("系统广播消息1111111111111111");
//		msg.add("系统广播消息222222222222");
//		msg.add("系统广播消息333333333333");
//		msg.add("系统广播消息444444444444");
//		SysServletContextListener.j2eeApplication.setAttribute("_SYSMSG", msg );
		
	}
	
}
